package com.yzzrjy.Dao.Impl;

import com.yzzrjy.Dao.Interfaces.ConfigDao;
import com.yzzrjy.bean.ServerConfigBean;
import com.yzzrjy.util.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class ConfigDaoMsql implements ConfigDao {
    @Override
    public ServerConfigBean getServerConfig(int id) throws SQLException {
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());
        ServerConfigBean bean = queryRunner.query("select * from server_config where id=?", new BeanHandler<>(ServerConfigBean.class), id);
        return bean;
    }
}
